package cn.slg.test;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.function.Consumer;
import java.util.function.Function;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Animal implements Comparable<Animal> {

    private String name;

    private Float Age;

    private Float blood;

    public Float getNum(Function<Animal, Float> getFunc) {
        return getFunc.apply(this);
    }

    @Override
    public int compareTo(Animal a) {
        return (int) (a.getAge() - this.getAge());
    }

    
}
